package com.hdax.dm.controller;

import com.hdax.dm.dto.IndexFloorDto;
import com.hdax.dm.dto.ItemsDto;
import com.hdax.dm.dto.SchedulerPeiceDto;
import com.hdax.dm.feign.SchedulerFeign;
import com.hdax.dm.item.Item;
import com.hdax.dm.scheduler.DmScheduler;
import com.hdax.dm.scheduler.DmSchedulerSeatPrice;
import com.hdax.dm.service.ItemService;
import com.hdax.dm.utils.response.CommonResponse;
import com.hdax.dm.utils.response.ResponseUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.security.PublicKey;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping(path = "/desc")
public class ItemsController {


    @Autowired
    private ItemService itemService;
    //详情
    @PostMapping(path = "/getItems")
    public CommonResponse<ItemsDto> getItems(@RequestBody Map<String,String> map){
        Long id = Long.valueOf(map.get("id"));

        return itemService.itemsId(id);
    }
    //演出时间
    @PostMapping(path = "/getTimePlan")
    public CommonResponse<List<DmScheduler>> getTimePlan(@RequestBody Map<String,String> map){
        String itemId = map.get("itemId");
        return itemService.getTimePlan(itemId);
    }

    //推荐信息
    @PostMapping(path = "/getRecommend")
    public CommonResponse<List<IndexFloorDto.FloorItems>> getRecommend(@RequestBody Map<String,String> map){
        String type1Id = map.get("itemTypeId");

        return itemService.senioritys(Long.valueOf(type1Id));
    }

    //根据排期id查找票价信息
    @PostMapping(path = "/getPrice")
    public CommonResponse<List<SchedulerPeiceDto>> getPrice(@RequestBody Map<String,String> map){
        String schedulerId = map.get("scheduleId");
        return itemService.getPrice(schedulerId);

    }
}
